﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="events.aspx.vb" Inherits="AssignmentProject.events" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" runat="server">
    <p>
        <br />
    </p>
    <asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1">
        <AlternatingItemTemplate>
            <span style="background-color: #FFF8DC;">&nbsp;<asp:Label ID="TitleLabel" 
                runat="server" Text='<%# Eval("Title") %>' />
            <br />
&nbsp;<asp:Label ID="StoryLabel" runat="server" Text='<%# Eval("Story") %>'></asp:Label>
            <br />
            &nbsp;<asp:Label ID="SubmittedLabel" runat="server" 
                Text='<%# Eval("Submitted") %>' />
            <br />
            <asp:Label ID="SubmissionDateLabel" runat="server" 
                Text='<%# Eval("SubmissionDate") %>' />
            <br />
            <asp:Hyperlink ID="h1" runat="server" Text="View Comments" NavigateUrl='<%#Eval("ID","News.aspx?ID={0}") %>' />
            <br />
            &nbsp;<asp:Label ID="CategoryLabel" runat="server" Text='<%# Eval("Category") %>' />
            <br />
<br /></span>
        </AlternatingItemTemplate>
        <EditItemTemplate>
            <span style="background-color: #008A8C;color: #FFFFFF;">Title:
            <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' />
            <br />
            Story:
            <asp:TextBox ID="StoryTextBox" runat="server" Text='<%# Bind("Story") %>' />
            <br />
            Submitted:
            <asp:TextBox ID="SubmittedTextBox" runat="server" 
                Text='<%# Bind("Submitted") %>' />
            <br />
            SubmissionDate:
            <asp:TextBox ID="SubmissionDateTextBox" runat="server" 
                Text='<%# Bind("SubmissionDate") %>' />
            <br />
            Category:
            <asp:TextBox ID="CategoryTextBox" runat="server" 
                Text='<%# Bind("Category") %>' />
            <br />
            <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                Text="Update" />
            <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                Text="Cancel" />
            <br /><br /></span>
        </EditItemTemplate>
        <EmptyDataTemplate>
            <span>No data was returned.</span>
        </EmptyDataTemplate>
        <InsertItemTemplate>
            <span style="">Title:
            <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' />
            <br />Story:
            <asp:TextBox ID="StoryTextBox" runat="server" Text='<%# Bind("Story") %>' />
            <br />Submitted:
            <asp:TextBox ID="SubmittedTextBox" runat="server" 
                Text='<%# Bind("Submitted") %>' />
            <br />SubmissionDate:
            <asp:TextBox ID="SubmissionDateTextBox" runat="server" 
                Text='<%# Bind("SubmissionDate") %>' />
            <br />Category:
            <asp:TextBox ID="CategoryTextBox" runat="server" 
                Text='<%# Bind("Category") %>' />
            <br />
            <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                Text="Insert" />
            <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                Text="Clear" />
            <br /><br /></span>
        </InsertItemTemplate>
        <ItemTemplate>
            <span style="background-color: #DCDCDC;color: #000000;">&nbsp;<asp:Label 
                ID="TitleLabel" runat="server" Text='<%# Eval("Title") %>' />
            <br />
            &nbsp;<asp:Label ID="StoryLabel" runat="server" Text='<%# Eval("Story") %>' />
            <br />
            &nbsp;<asp:Label ID="SubmittedLabel" runat="server" 
                Text='<%# Eval("Submitted") %>' />
            <br />
            &nbsp;<asp:Label ID="SubmissionDateLabel" runat="server" 
                Text='<%# Eval("SubmissionDate") %>' />
            <br />
            <asp:Hyperlink ID="h1" runat="server" Text="View Comments" NavigateUrl='<%#Eval("ID","News.aspx?ID={0}") %>' />
            <br />
            Category:
            <asp:Label ID="CategoryLabel" runat="server" Text='<%# Eval("Category") %>' />
            <br />
<br /></span>
        </ItemTemplate>
        <LayoutTemplate>
            <div ID="itemPlaceholderContainer" runat="server" 
                style="font-family: Verdana, Arial, Helvetica, sans-serif;">
                <span runat="server" id="itemPlaceholder" />
            </div>
            <div style="text-align: center;background-color: #CCCCCC;font-family: Verdana, Arial, Helvetica, sans-serif;color: #000000;">
            </div>
        </LayoutTemplate>
        <SelectedItemTemplate>
            <span style="background-color: #008A8C;font-weight: bold;color: #FFFFFF;">Title:
            <asp:Label ID="TitleLabel" runat="server" Text='<%# Eval("Title") %>' />
            <br />
            Story:
            <asp:Label ID="StoryLabel" runat="server" Text='<%# Eval("Story") %>' />
            <br />
            Submitted:
            <asp:Label ID="SubmittedLabel" runat="server" Text='<%# Eval("Submitted") %>' />
            <br />
            SubmissionDate:
            <asp:Label ID="SubmissionDateLabel" runat="server" 
                Text='<%# Eval("SubmissionDate") %>' />
            <br />
            Category:
            <asp:Label ID="CategoryLabel" runat="server" Text='<%# Eval("Category") %>' />
            <br />
<br /></span>
        </SelectedItemTemplate>
    </asp:ListView>
    <p>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
            SelectCommand="SELECT [ID],[Title], [Story], [Submitted], [SubmissionDate], [Category] FROM [NewsItems] WHERE ([Category] = ?)">
            <SelectParameters>
                <asp:Parameter DefaultValue="Events" Name="Category" Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
    </p>
</asp:Content>
